/*
 * Copyright (C) 2025 Tsingteng MicroSystem
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**
 * @file nci_feature.h
 * @brief 定义NCI功能开关
 */

#ifndef _NCI_FEATURE_H_
#define _NCI_FEATURE_H_


/**
 * 新增NCI FEATURE步骤：
 * 1. 添加FEATURE项目宏定义，如NCI_FEATURE_XX ((1 << x) | 依赖的FEATURE项目)
 *    其中x为FEATURE编号，不能和已有的FEATURE编号重复，且最大为31
 *    其中如果没有依赖的FEATUER，则可以不用|上任何FEATURE项目
 *    如：#define NCI_FEATURE_XX ((1 << x))
 * 2. 在需要被FEATURE控制的文件中 include本头文件
 *    如：#include "nci_feature.h"
 * 3. 在需要被FEATURE控制的文件中需要进行FEATURE控制的地方添加对FEAATUR的判断：
 *    如：#if IS_FEATURE_ON(NCI_FEATURE_XX)
 * 4. 在需要被FEATURE控制的文件中不再需要FEATURE控制的地方面添加endif：
 *    如：#endif
 */


#define NCI_FEATURE_EE         ((1 << 0))
#define NCI_FEATURE_ROUTING    ((1 << 1) | NCI_FEATURE_EE)
#define NCI_FEATURE_RW         ((1 << 2))
#define NCI_FEATURE_CE         ((1 << 3) | NCI_FEATURE_ROUTING)
#define NCI_FEATURE_HCI        ((1 << 4) | NCI_FEATURE_EE)
#define NCI_FEATURE_WIRED_SE   ((1 << 5) | NCI_FEATURE_HCI)
#define NCI_FEATURE_RW_NDEF    ((1 << 6) | NCI_FEATURE_RW)
#define NCI_FEATURE_RW_T1T     ((1 << 7) | NCI_FEATURE_RW)
#define NCI_FEATURE_RW_T2T     ((1 << 8) | NCI_FEATURE_RW)
#define NCI_FEATURE_RW_T3T     ((1 << 9) | NCI_FEATURE_RW)
#define NCI_FEATURE_RW_T4T     ((1 << 10) | NCI_FEATURE_RW)
#define NCI_FEATURE_RW_T5T     ((1 << 11) | NCI_FEATURE_RW)
#define NCI_FEATURE_RW_M1      ((1 << 12) | NCI_FEATURE_RW)
#define NCI_FEATURE_RW_CI      ((1 << 13) | NCI_FEATURE_RW)
#define NCI_FEATURE_EE_DH      ((1 << 14) | NCI_FEATURE_EE)
#define NCI_FEATURE_EE_T4T     ((1 << 15) | NCI_FEATURE_EE)
#define NCI_FEATURE_RW_EXT     ((1 << 16) | NCI_FEATURE_RW) // 读卡相关的扩展功能
#define NCI_FEATURE_RW_NDEF_EXT ((1 << 17) | NCI_FEATURE_RW_NDEF) // 读卡NDEF相关的扩展功能
#define NCI_FEATURE_VS         ((1 << 18))
#define NCI_FEATURE_CE_DH      ((1 << 19) | NCI_FEATURE_CE)

#define NCI_FEATURE_DEFAULT_ALL_ENABLE (0xFFFFFFFF) // 默认开启所有功能

#ifndef NCI_FEATURE
#define NCI_FEATURE NCI_FEATURE_DEFAULT_ALL_ENABLE
#endif

/** @brief 判断某个FEATUER是否是启用状态 */
#define IS_FEATURE_ON(_feature) ((NCI_FEATURE & _feature) == _feature)

#endif /* _NCI_FEATURE_H_ */
